
let playerSprite = undefined;
let player = {
    xSpeed: 20,
    ySpeed: 20,
    nowXSpeed: 0,
    nowYSpeed: 0,

    isOnXCenter: true,
    isOnYCenter: true,
};

// 玩家模块
exports.init = init;
exports.playerSprite = playerSprite;
exports.player = player;
exports.ticker = ticker;

const PLAYER_REOURCE = "resources/player/flowerTop.png"; // 玩家
const BOY_RESOURCE = "resources/player/spineboy-pro.json"; // 男孩
const PIXI = require("pixi.js");


console.log("玩家模块，应该只执行一次");

function init(app, container) {
    // playerSprite = new PIXI.Sprite(
    // PIXI.Loader.shared.resources[PLAYER_REOURCE].texture
    // );
    playerSprite = new PIXI.spine.Spine(
        PIXI.Loader.shared.resources[BOY_RESOURCE].spineData
    )
    playerSprite.scale.x = 0.4;
    playerSprite.scale.y = 0.4;
    playerSprite.x = app.screen.width / 2;
    playerSprite.y = app.screen.height / 2;
    container.addChild(playerSprite);
}

function ticker() {

}